package sweetsaremeat.beehive.View;

import sweetsaremeat.beehive.Model.Vector2;

public class Camera 
{
	//the camera's position
	//NOTE: when set to 0,0 it's at the center
	public Vector2 m_pos;
	
	public Vector2 m_center;
	public float m_scale;
	
	public int m_width; //the width that the camera can see
	public int m_height; //the height that the camera can see
    
	public Camera()
    {
		m_pos = new Vector2(0, 0);
		m_center = new Vector2(0, 0);
		
		m_scale = 1.0f;
    }
	
    public Camera(int a_width, int a_height, float a_scale)
    {
    	m_pos = new Vector2(0, 0);
    	
    	//set the camera pos to the center as default
    	m_center = new Vector2((float)a_width * 0.5f, (float)a_height * 0.5f);
    	
    	m_width = a_width;
    	m_height = a_height;
    	
    	m_scale = a_scale;
    }
    
    public void SetCameraBorders(int a_width, int a_height)
    { 	
    	m_center.x = (float)a_width * 0.5f;
    	m_center.y = (float)a_height * 0.5f;
    	
    	m_width = a_width;
    	m_height = a_height;
    }
    
    //model -> view
    public float GetScreenPosX(float a_x)
    {
    	return a_x * m_scale;
    }
    
  //model -> view
    public float GetScreenPosY(float a_y)
    {
    	return a_y * m_scale;
    }
    
    public float GetScreenCenterX()
    {
    	return m_center.x + m_pos.x;
    }
    
    public float GetScreenCenterY()
    {
    	return m_center.y + m_pos.y;
    }
}
